package com.zzy.test;

import redis.clients.jedis.Jedis;

import java.util.List;

public class RedisDel {
    public static void main(String[] args) {
        //连接本地的 Redis 服务
        Jedis jedis = new Jedis("localhost");
        deleteData(jedis , "runoobkey");
    }

    public static boolean deleteData(Jedis jedis ,String key){
        if (jedis.exists(key)) {
            if (jedis.del(key) == 1) {
                System.out.println("删除成功！");
                return true;
            } else {
                return false;
            }
        } else {
            System.out.println(" Key: "+key+ " 不存在！");
            return false;
        }
    }
}
